### -*- coding: utf-8 -*- #############################################
# Разработано компанией Ключевые Решения (http://keysolutions.ru/)
# Все права защищены, 2006-2007
#
# Developed by Key Solutions (http://keysolutions.ru/)
# All right reserved, 2006-2007
#######################################################################
"""News class for the Zope 3 based news package

$Id: installsmartimagecache.py 13 2007-11-27 21:44:13Z Arvi3D $
"""
__author__  = "Sergey Shilov"
__license__ = "<undefined>" # необходимо согласование
__version__ = "$Revision: 13 $"
__date__ = "$Date: 2007-11-27 21:44:13 +0000 (Tue, 27 Nov 2007) $"

from ks.smartimage.smartimagecache.smartimagecache import SmartImageCache, Scale
from ks.smartimage.smartimagecache.interfaces import ISmartImageProp
##from sportcontent.registry.interfaces import IRegistry
##from zope.component import getUtility

def installSmartImageCache(context, **kw):
    """Устанавливает экземпляр SmartImageCache"""
    sm = context.getSiteManager()
    obj = SmartImageCache()

    obj.scales = (Scale(name=u'bigLogo', width=482,height=188),
        Scale(name=u'imagelistLogo', width=232, height=86),
        Scale(name=u'listingLogo', width=135, height=69))
    obj.format = u'JPEG'
    obj.mode = u'RGB'
    obj.scale = u'imagelistLogo'

    sm["SmartImageCache"] = obj
    sm.registerUtility(obj, provided=ISmartImageProp)

    return "OK"
